const PrerenderSPAPlugin = require('prerender-spa-plugin');
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer;
const path = require('path');
module.exports = {
  configureWebpack: config => {
    if (process.env.NODE_ENV !== 'production') return;
    return {
      plugins: [
        new PrerenderSPAPlugin({
          staticDir: path.join(__dirname,'ecwalk'),
          routes: ['/channelPage'],
          renderer: new Renderer({
            inject: {
              foo: 'bar'
            },
            headless: false,
            renderAfterDocumentEvent: 'render-event',
            //renderAfterTime: 5000,
            //renderAfterElementExists: 'my-app-element'
          }),
        })
      ],
    };
  },
  // publicPath: process.env.NODE_ENV === 'production' ? '/gzl-mobile/' : '/',
  outputDir: 'ecwalk',
  devServer: {
    port: 9099,
    proxy: {
      '/ecwalk': {
        target: 'https://easy-mock.com/mock/5c4ffde97256a11ea14420f1',
        ws: true,
        changeOrigin: true
      }
    }
  }
};

